package xyz.robinbingo.effectivejava.chapter04.item17;

import cn.hutool.core.lang.Console;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import xyz.robinbingo.effectivejava.chapter04.item17.first.Complex;

import java.math.BigInteger;

/**
 * @author Robin
 * @date 2019/03/21 15:33
 **/
@RunWith(SpringRunner.class)
@SpringBootTest
public class Item17 {

    @Test
    public void test00() {
        Complex c = new Complex(1, 1);
        Complex plus = c.plus(new Complex(2, 2));
        Console.log(plus);
    }

    @Test
    public void test01() {
        Console.log(Complex.I);
    }

    @Test
    public void test02() {
        BigInteger moby = BigInteger.valueOf(7346544777L * 999999999L);
        moby = moby.flipBit(0);
        StringBuilder sb = new StringBuilder();
        sb.append("aa").append("bb");
    }

    @Test
    public void test03() {
        xyz.robinbingo.effectivejava.chapter04.item17.second.Complex complex =
                xyz.robinbingo.effectivejava.chapter04.item17.second.Complex.valueOf(1, 1);
    }

    @Test
    public void test04() {
        A a = new A("100");
        Console.log(a);
        BigInteger bigInteger = A.safeInstance(a);
        Console.log(bigInteger);
    }

}
